The PointFacQuery object contains the following methods:
Note: Some of the examples in this topic use the WScript.Sleep statement, which is not recommended for use when scripting in CygNet Studio. Use TheView EventTimer instead.
The CancelPointFacFiltering method cancels the filtering of points.
CancelPointFacFiltering()
Example
The following example cleans up the query after it is finished, by canceling the filtering destroying the filter.
|
Sub
' point/fac query is finished PointFacQuery.CancelPointFacFiltering() PointFacQuery.DestroyPointFacFilter(100)
End Sub |
The ClearQueryResults method clears the results of a previous query and initializes the processing flags. The query (filter) itself is not cleared.
ClearQueryResults()
Clearing the results of a previous query is good programming practice if multiple queries are to be performed.
Example
The following example addresses clearing the query results before retrieving data from the query.
|
Sub
' query is all set up While bIsFiltering
WScript.Sleep(1000)
' call before retrieving data PointFacQuery.ClearQueryResults()
' retrieve data, etc. Wend
End Sub |
The CreatePointFacFilter method creates a new point/fac filter thread.
CreatePointFacFilter(UpdateInterval As Integer) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
UpdateInterval |
Yes |
The periodic run interval in seconds. |
Example
The following example goes through the entire process of creating a filter, setting the CVS site services, setting facility and point filters, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
|
Sub
'-----------------SETUP------------------
Dim bCreatedOk bCreatedOk = PointFacQuery.CreatePointFacFilter(5)
Dim bIsRunning bIsRunning = PointFacQuery.IsPointFacFilterRunning()
PointFacQuery.ClearQueryResults
Dim bSetServices bSetServices = PointFacQuery.SetCvsSiteServices("CYGDEMO.UIS")
'set the FAC filter from an existing XML (see the documentation for 'SetFacilityFilter for an example of an XML filter) Dim bSetFilter bSetFilter = PointFacQuery.SetFacilityFilter(g_xmlFacFilter)
'set the PNT filter from an existing XML (see the documentation for 'SetPointFilter for an example of an XML filter) bSetFilter = PointFacQuery.SetPointFilter(g_xmlPntFilter)
Dim bNotificationSet bNotificationSet = PointFacQuery.SetNotificationPoint("CYGDEMO.UIS:EVENTIF_NOTIFICATION_PT")
'-----------------EXECUTION------------------
Dim bFilteringStarted bFilteringStarted = PointFacQuery.StartPointFacFiltering
WScript.Sleep(5000) 'simulating polling the notification point
'-----------------RESULTS------------------
Dim pvTagList, bGotList pvTagList = "" bGotList = PointFacQuery.GetFilteredPointList(pvTagList)
Dim nSize, bGotSize nSize = 0 bGotSize = PointFacQuery.GetFilteredPointListSize(nSize)
If nSize > 0 Then
Dim strTag, pvInfoXml, bRetrieved, iRec For iRec = 0 To UBound(pvTagList)
strTag = pvTagList(iRec)
pvInfoXml = "" bRetrieved = PointFacQuery.GetPointInfoAsXml(strTag, pvInfoXml) MsgBox pvInfoXml
pvInfoXml = "" bRetrieved = PointFacQuery.GetPointCommentAsXml(strTag, pvInfoXml) MsgBox pvInfoXml
Next
'clear the query and the cache PointFacQuery.ClearQueryResults
End If
PointFacQuery.CancelPointFacFiltering() PointFacQuery.DestroyPointFacFilter(100)
End Sub |
The DestroyPointFacFilter method terminates execution of the filter thread, and waits for the specified number of seconds.
DestroyPointFacFilter(TimeToWaitInSeconds As Integer) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
TimeToWaitInSeconds |
Yes |
The number of seconds to wait for the point fac query to terminate. This value must be within the range [1 - 100]. |
This method will hang for the specified number of seconds while the filter thread terminates. If the filter thread has not terminated by the time the interval has expired, this method will return false and the filter thread will continue to attempt to terminate in the background. Call this method as part of the cleanup routine after querying is finished.
Example
The following example cleans up the query after it is finished, by canceling the filtering and destroying the filter.
|
Sub
' point/fac query is finished PointFacQuery.CancelPointFacFiltering() PointFacQuery.DestroyPointFacFilter(100)
End Sub |
The GetFilteredPointList method returns the list of filtered points as fully qualified point tags.
GetFilteredPointList(SiteSvcKeyList As Array) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
SiteSvcKeyList |
Yes |
A list of fully qualified point tags representing the filtered points. |
After querying is complete, this method is used in conjunction with GetPointInfoAsXml and/or GetPointCommentAsXml to display the results of the query.
Example
The following example goes through the entire process of creating a filter, setting the CVS site services, setting facility and point filters, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
|
Sub
'-----------------SETUP------------------
Dim bCreatedOk bCreatedOk = PointFacQuery.CreatePointFacFilter(5)
Dim bIsRunning bIsRunning = PointFacQuery.IsPointFacFilterRunning()
PointFacQuery.ClearQueryResults
Dim bSetServices bSetServices = PointFacQuery.SetCvsSiteServices("CYGDEMO.UIS")
'set the FAC filter from an existing XML (see the documentation for 'SetFacilityFilter for an example of an XML filter) Dim bSetFilter bSetFilter = PointFacQuery.SetFacilityFilter(g_xmlFacFilter)
'set the PNT filter from an existing XML (see the documentation for 'SetPointFilter for an example of an XML filter) bSetFilter = PointFacQuery.SetPointFilter(g_xmlPntFilter)
Dim bNotificationSet bNotificationSet = PointFacQuery.SetNotificationPoint("CYGDEMO.UIS:EVENTIF_NOTIFICATION_PT")
'-----------------EXECUTION------------------
Dim bFilteringStarted bFilteringStarted = PointFacQuery.StartPointFacFiltering
WScript.Sleep(5000) 'simulating polling the notification point
'-----------------RESULTS------------------
Dim pvTagList, bGotList pvTagList = "" bGotList = PointFacQuery.GetFilteredPointList(pvTagList)
Dim nSize, bGotSize nSize = 0 bGotSize = PointFacQuery.GetFilteredPointListSize(nSize)
If nSize > 0 Then
Dim strTag, pvInfoXml, bRetrieved, iRec For iRec = 0 To UBound(pvTagList)
strTag = pvTagList(iRec)
pvInfoXml = "" bRetrieved = PointFacQuery.GetPointInfoAsXml(strTag, pvInfoXml) MsgBox pvInfoXml
pvInfoXml = "" bRetrieved = PointFacQuery.GetPointCommentAsXml(strTag, pvInfoXml) MsgBox pvInfoXml
Next
'clear the query and the cache PointFacQuery.ClearQueryResults
End If
PointFacQuery.CancelPointFacFiltering() PointFacQuery.DestroyPointFacFilter(100)
End Sub |
The GetFilteredPointListSize method returns the size of the filtered point list as an integer
GetFilteredPointListSize(Size As Integer) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Size |
Yes |
The size of the filtered point list. |
The filtered point list itself can be obtained via GetFilteredPointList.
Example
The following example goes through the entire process of creating a filter, setting the CVS site services, setting facility and point filters, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
|
Sub
'-----------------SETUP------------------
Dim bCreatedOk bCreatedOk = PointFacQuery.CreatePointFacFilter(5)
Dim bIsRunning bIsRunning = PointFacQuery.IsPointFacFilterRunning()
PointFacQuery.ClearQueryResults
Dim bSetServices bSetServices = PointFacQuery.SetCvsSiteServices("CYGDEMO.UIS")
'set the FAC filter from an existing XML (see the documentation for 'SetFacilityFilter for an example of an XML filter) Dim bSetFilter bSetFilter = PointFacQuery.SetFacilityFilter(g_xmlFacFilter)
'set the PNT filter from an existing XML (see the documentation for 'SetPointFilter for an example of an XML filter) bSetFilter = PointFacQuery.SetPointFilter(g_xmlPntFilter)
Dim bNotificationSet bNotificationSet = PointFacQuery.SetNotificationPoint("CYGDEMO.UIS:EVENTIF_NOTIFICATION_PT")
'-----------------EXECUTION------------------
Dim bFilteringStarted bFilteringStarted = PointFacQuery.StartPointFacFiltering
WScript.Sleep(5000) 'simulating polling the notification point
'-----------------RESULTS------------------
Dim pvTagList, bGotList pvTagList = "" bGotList = PointFacQuery.GetFilteredPointList(pvTagList)
Dim nSize, bGotSize nSize = 0 bGotSize = PointFacQuery.GetFilteredPointListSize(nSize)
If nSize > 0 Then
Dim strTag, pvInfoXml, bRetrieved, iRec For iRec = 0 To UBound(pvTagList)
strTag = pvTagList(iRec)
pvInfoXml = "" bRetrieved = PointFacQuery.GetPointInfoAsXml(strTag, pvInfoXml) MsgBox pvInfoXml
pvInfoXml = "" bRetrieved = PointFacQuery.GetPointCommentAsXml(strTag, pvInfoXml) MsgBox pvInfoXml
Next
'clear the query and the cache PointFacQuery.ClearQueryResults
End If
PointFacQuery.CancelPointFacFiltering() PointFacQuery.DestroyPointFacFilter(100)
End Sub |
The GetPointCommentAsXml method returns the point comment for the given tag.
GetPointCommentAsXml(Tag As String, PointCommentXml As Variant) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Tag |
Yes |
A fully qualified point tag. |
|
PointCommentXml |
Yes |
The point comment for the tag returned as an XML string. |
After querying is complete, this method is used in conjunction with GetFilteredPointList to display the results of the query.
Example
The following example goes through the entire process of creating a filter, setting the CVS site services, setting facility and point filters, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
|
Sub
'-----------------SETUP------------------
Dim bCreatedOk bCreatedOk = PointFacQuery.CreatePointFacFilter(5)
Dim bIsRunning bIsRunning = PointFacQuery.IsPointFacFilterRunning()
PointFacQuery.ClearQueryResults
Dim bSetServices bSetServices = PointFacQuery.SetCvsSiteServices("CYGDEMO.UIS")
'set the FAC filter from an existing XML (see the documentation for 'SetFacilityFilter for an example of an XML filter) Dim bSetFilter bSetFilter = PointFacQuery.SetFacilityFilter(g_xmlFacFilter)
'set the PNT filter from an existing XML (see the documentation for 'SetPointFilter for an example of an XML filter) bSetFilter = PointFacQuery.SetPointFilter(g_xmlPntFilter)
Dim bNotificationSet bNotificationSet = PointFacQuery.SetNotificationPoint("CYGDEMO.UIS:EVENTIF_NOTIFICATION_PT")
'-----------------EXECUTION------------------
Dim bFilteringStarted bFilteringStarted = PointFacQuery.StartPointFacFiltering
WScript.Sleep(5000) 'simulating polling the notification point
'-----------------RESULTS------------------
Dim pvTagList, bGotList pvTagList = "" bGotList = PointFacQuery.GetFilteredPointList(pvTagList)
Dim nSize, bGotSize nSize = 0 bGotSize = PointFacQuery.GetFilteredPointListSize(nSize)
If nSize > 0 Then
Dim strTag, pvInfoXml, bRetrieved, iRec For iRec = 0 To UBound(pvTagList)
strTag = pvTagList(iRec)
pvInfoXml = "" bRetrieved = PointFacQuery.GetPointInfoAsXml(strTag, pvInfoXml) MsgBox pvInfoXml
pvInfoXml = "" bRetrieved = PointFacQuery.GetPointCommentAsXml(strTag, pvInfoXml) MsgBox pvInfoXml
Next
'clear the query and the cache PointFacQuery.ClearQueryResults
End If
PointFacQuery.CancelPointFacFiltering() PointFacQuery.DestroyPointFacFilter(100)
End Sub |
The GetPointInfoAsXml method returns point information for the given tag.
GetPointInfoAsXml(Tag As String, PointInfoXml As Variant) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Tag |
Yes |
A fully qualified point tag. |
|
PointInfoXml |
Yes |
The point information for the tag returned as an XML string. |
After querying is complete, this method is used in conjunction with GetFilteredPointList to display the results of the query.
Example
The following example goes through the entire process of creating a filter, setting the CVS site services, setting facility and point filters, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
|
Sub
'-----------------SETUP------------------
Dim bCreatedOk bCreatedOk = PointFacQuery.CreatePointFacFilter(5)
Dim bIsRunning bIsRunning = PointFacQuery.IsPointFacFilterRunning()
PointFacQuery.ClearQueryResults
Dim bSetServices bSetServices = PointFacQuery.SetCvsSiteServices("CYGDEMO.UIS")
'set the FAC filter from an existing XML (see the documentation for 'SetFacilityFilter for an example of an XML filter) Dim bSetFilter bSetFilter = PointFacQuery.SetFacilityFilter(g_xmlFacFilter)
'set the PNT filter from an existing XML (see the documentation for 'SetPointFilter for an example of an XML filter) bSetFilter = PointFacQuery.SetPointFilter(g_xmlPntFilter)
Dim bNotificationSet bNotificationSet = PointFacQuery.SetNotificationPoint("CYGDEMO.UIS:EVENTIF_NOTIFICATION_PT")
'-----------------EXECUTION------------------
Dim bFilteringStarted bFilteringStarted = PointFacQuery.StartPointFacFiltering
WScript.Sleep(5000) 'simulating polling the notification point
'-----------------RESULTS------------------
Dim pvTagList, bGotList pvTagList = "" bGotList = PointFacQuery.GetFilteredPointList(pvTagList)
Dim nSize, bGotSize nSize = 0 bGotSize = PointFacQuery.GetFilteredPointListSize(nSize)
If nSize > 0 Then
Dim strTag, pvInfoXml, bRetrieved, iRec For iRec = 0 To UBound(pvTagList)
strTag = pvTagList(iRec)
pvInfoXml = "" bRetrieved = PointFacQuery.GetPointInfoAsXml(strTag, pvInfoXml) MsgBox pvInfoXml
pvInfoXml = "" bRetrieved = PointFacQuery.GetPointCommentAsXml(strTag, pvInfoXml) MsgBox pvInfoXml
Next
'clear the query and the cache PointFacQuery.ClearQueryResults
End If
PointFacQuery.CancelPointFacFiltering() PointFacQuery.DestroyPointFacFilter(100)
End Sub |
The IsPointFacFilterFiltering method returns true if the entire query process has been set up and is enabled to run.
IsPointFacFilterFiltering() As Boolean
This method will return true after a successful call to StartPointFacFiltering. Once the filtering has begun, this method will only return false if the filtering has been canceled using CancelPointFacFiltering, or if the filter has been destroyed using DestroyPointFacFilter.
Example
The following example goes through the entire process of creating a filter, setting the CVS site services, setting facility and point filters, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
|
Sub
'-----------------SETUP------------------
Dim bCreatedOk bCreatedOk = PointFacQuery.CreatePointFacFilter(5)
Dim bIsRunning bIsRunning = PointFacQuery.IsPointFacFilterRunning()
PointFacQuery.ClearQueryResults
Dim bSetServices bSetServices = PointFacQuery.SetCvsSiteServices("CYGDEMO.UIS")
'set the FAC filter from an existing XML (see the documentation for 'SetFacilityFilter for an example of an XML filter) Dim bSetFilter bSetFilter = PointFacQuery.SetFacilityFilter(g_xmlFacFilter)
'set the PNT filter from an existing XML (see the documentation for 'SetPointFilter for an example of an XML filter) bSetFilter = PointFacQuery.SetPointFilter(g_xmlPntFilter)
Dim bNotificationSet bNotificationSet = PointFacQuery.SetNotificationPoint("CYGDEMO.UIS:EVENTIF_NOTIFICATION_PT")
'-----------------EXECUTION------------------
Dim bFilteringStarted bFilteringStarted = PointFacQuery.StartPointFacFiltering
WScript.Sleep(5000) 'simulating polling the notification point
'-----------------RESULTS------------------
Dim pvTagList, bGotList pvTagList = "" bGotList = PointFacQuery.GetFilteredPointList(pvTagList)
Dim nSize, bGotSize nSize = 0 bGotSize = PointFacQuery.GetFilteredPointListSize(nSize)
If nSize > 0 Then
Dim strTag, pvInfoXml, bRetrieved, iRec For iRec = 0 To UBound(pvTagList)
strTag = pvTagList(iRec)
pvInfoXml = "" bRetrieved = PointFacQuery.GetPointInfoAsXml(strTag, pvInfoXml) MsgBox pvInfoXml
pvInfoXml = "" bRetrieved = PointFacQuery.GetPointCommentAsXml(strTag, pvInfoXml) MsgBox pvInfoXml
Next
'clear the query and the cache PointFacQuery.ClearQueryResults
End If
PointFacQuery.CancelPointFacFiltering() PointFacQuery.DestroyPointFacFilter(100)
End Sub |
The IsPointFacFilterFiltering method returns true if the point fac query thread is running.
IsPointFacFilterRunning() As Boolean
The point fac query thread is executed after a point fac filter is created; therefore, after a point fac filter is created, this method will only return false if the filter has been destroyed using DestroyPointFacFilter.
Example
The following example creates a point fac filter, checks that it is running, destroys it, and checks that it is no longer running.
|
Sub
Dim bCreatedOk bCreatedOk = PointFacQuery.CreatePointFacFilter(5)
Dim bRunning bRunning = PointFacQuery.IsPointFacFilterRunning()
MsgBox bRunning 'should be "True"
PointFacQuery.DestroyPointFacFilter(100)
bRunning = PointFacQuery.IsPointFacFilterRunning()
MsgBox bRunning 'should be "False"
End Sub |
The SetCvsSiteServices method defines the list of CVS site services for the point fac filter.
SetCvsSiteServices(SiteServices As String) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
SiteServices |
Yes |
A semicolon-delimited list of CVS Site.Services (for example, "CYGDEMO.UIS;CYGDEMO.UIS1") |
This method will only return false if a filter has not yet been created.
Example
The following example goes through the entire process of creating a filter, setting the CVS site services, setting facility and point filters, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
|
Sub
'-----------------SETUP------------------
Dim bCreatedOk bCreatedOk = PointFacQuery.CreatePointFacFilter(5)
Dim bIsRunning bIsRunning = PointFacQuery.IsPointFacFilterRunning()
PointFacQuery.ClearQueryResults
Dim bSetServices bSetServices = PointFacQuery.SetCvsSiteServices("CYGDEMO.UIS")
'set the FAC filter from an existing XML (see the documentation for 'SetFacilityFilter for an example of an XML filter) Dim bSetFilter bSetFilter = PointFacQuery.SetFacilityFilter(g_xmlFacFilter)
'set the PNT filter from an existing XML (see the documentation for 'SetPointFilter for an example of an XML filter) bSetFilter = PointFacQuery.SetPointFilter(g_xmlPntFilter)
Dim bNotificationSet bNotificationSet = PointFacQuery.SetNotificationPoint("CYGDEMO.UIS:EVENTIF_NOTIFICATION_PT")
'-----------------EXECUTION------------------
Dim bFilteringStarted bFilteringStarted = PointFacQuery.StartPointFacFiltering
WScript.Sleep(5000) 'simulating polling the notification point
'-----------------RESULTS------------------
Dim pvTagList, bGotList pvTagList = "" bGotList = PointFacQuery.GetFilteredPointList(pvTagList)
Dim nSize, bGotSize nSize = 0 bGotSize = PointFacQuery.GetFilteredPointListSize(nSize)
If nSize > 0 Then
Dim strTag, pvInfoXml, bRetrieved, iRec For iRec = 0 To UBound(pvTagList)
strTag = pvTagList(iRec)
pvInfoXml = "" bRetrieved = PointFacQuery.GetPointInfoAsXml(strTag, pvInfoXml) MsgBox pvInfoXml
pvInfoXml = "" bRetrieved = PointFacQuery.GetPointCommentAsXml(strTag, pvInfoXml) MsgBox pvInfoXml
Next
'clear the query and the cache PointFacQuery.ClearQueryResults
End If
PointFacQuery.CancelPointFacFiltering() PointFacQuery.DestroyPointFacFilter(100)
End Sub |
The SetFacilityFilter method sets the facility filter from an XML string.
SetFacilityFilterAsXml(XmlFilter As String) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
XmlFilter |
Yes |
The XML string representing the facility filter to be set. |
This method returns false if the XML filter is invalid. The following is an example of an XML facility filter.
|
<ExportedRules exportTime='8/17/2019 11:26:44.630' ruleDataIdentifier='FAC Rules'> <Rules enabled='true' inverted='false' op='1' name=''> <Rule enabled='true' name='' referenceAttr='0' compareToType='0' value='GENFAC' operator='=' qualifier='Case Sensitive'> <compareItem attr='facility_type'/> </Rule> <Rule enabled='true' name='' referenceAttr='0' compareToType='0' value='true' operator='=' qualifier='Case Sensitive'> <compareItem attr='facility_is_ref_any'/> </Rule> </Rules> </ExportedRules> |
This filter will select all points for facilities for which (facility_type = "GENFAC" AND facility_is_ref_any = "true"). Note that the "op='1'" attribute specifies that the rules are ANDed. To OR a set of rules, use "op='0'". For a complete list of FAC XML property names, see FAC XML Attributes.
Example
The following example goes through the entire process of creating a filter, setting the CVS site services, setting facility and point filters, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
|
Sub
'-----------------SETUP------------------
Dim bCreatedOk bCreatedOk = PointFacQuery.CreatePointFacFilter(5)
Dim bIsRunning bIsRunning = PointFacQuery.IsPointFacFilterRunning()
PointFacQuery.ClearQueryResults
Dim bSetServices bSetServices = PointFacQuery.SetCvsSiteServices("CYGDEMO.UIS")
'set the FAC filter from an existing XML (see the documentation for 'SetFacilityFilter for an example of an XML filter) Dim bSetFilter bSetFilter = PointFacQuery.SetFacilityFilter(g_xmlFacFilter)
'set the PNT filter from an existing XML (see the documentation for 'SetPointFilter for an example of an XML filter) bSetFilter = PointFacQuery.SetPointFilter(g_xmlPntFilter)
Dim bNotificationSet bNotificationSet = PointFacQuery.SetNotificationPoint("CYGDEMO.UIS:EVENTIF_NOTIFICATION_PT")
'-----------------EXECUTION------------------
Dim bFilteringStarted bFilteringStarted = PointFacQuery.StartPointFacFiltering
WScript.Sleep(5000) 'simulating polling the notification point
'-----------------RESULTS------------------
Dim pvTagList, bGotList pvTagList = "" bGotList = PointFacQuery.GetFilteredPointList(pvTagList)
Dim nSize, bGotSize nSize = 0 bGotSize = PointFacQuery.GetFilteredPointListSize(nSize)
If nSize > 0 Then
Dim strTag, pvInfoXml, bRetrieved, iRec For iRec = 0 To UBound(pvTagList)
strTag = pvTagList(iRec)
pvInfoXml = "" bRetrieved = PointFacQuery.GetPointInfoAsXml(strTag, pvInfoXml) MsgBox pvInfoXml
pvInfoXml = "" bRetrieved = PointFacQuery.GetPointCommentAsXml(strTag, pvInfoXml) MsgBox pvInfoXml
Next
'clear the query and the cache PointFacQuery.ClearQueryResults
End If
PointFacQuery.CancelPointFacFiltering() PointFacQuery.DestroyPointFacFilter(100)
End Sub |
The SetNotificationPoint method sets the CVS point which will contain a notification of when the queries have completed.
SetNotificationPoint(Tag As String) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Tag |
Yes |
The CVS tag of the point to be used for notifications (for example, "CYGDEMO.UIS:EVENTIF_NOTIFICATION_PT"). |
This method will return false if the specified tag is invalid. Note that this method does not actually create a CVS point. A CVS point with the specified tag must exist prior to starting alarm filtering in order for CVS notifications to succeed.
Example
The following example goes through the entire process of creating a filter, setting the CVS site services, setting facility and point filters, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
|
Sub
'-----------------SETUP------------------
Dim bCreatedOk bCreatedOk = PointFacQuery.CreatePointFacFilter(5)
Dim bIsRunning bIsRunning = PointFacQuery.IsPointFacFilterRunning()
PointFacQuery.ClearQueryResults
Dim bSetServices bSetServices = PointFacQuery.SetCvsSiteServices("CYGDEMO.UIS")
'set the FAC filter from an existing XML (see the documentation for 'SetFacilityFilter for an example of an XML filter) Dim bSetFilter bSetFilter = PointFacQuery.SetFacilityFilter(g_xmlFacFilter)
'set the PNT filter from an existing XML (see the documentation for 'SetPointFilter for an example of an XML filter) bSetFilter = PointFacQuery.SetPointFilter(g_xmlPntFilter)
Dim bNotificationSet bNotificationSet = PointFacQuery.SetNotificationPoint("CYGDEMO.UIS:EVENTIF_NOTIFICATION_PT")
'-----------------EXECUTION------------------
Dim bFilteringStarted bFilteringStarted = PointFacQuery.StartPointFacFiltering
WScript.Sleep(5000) 'simulating polling the notification point
'-----------------RESULTS------------------
Dim pvTagList, bGotList pvTagList = "" bGotList = PointFacQuery.GetFilteredPointList(pvTagList)
Dim nSize, bGotSize nSize = 0 bGotSize = PointFacQuery.GetFilteredPointListSize(nSize)
If nSize > 0 Then
Dim strTag, pvInfoXml, bRetrieved, iRec For iRec = 0 To UBound(pvTagList)
strTag = pvTagList(iRec)
pvInfoXml = "" bRetrieved = PointFacQuery.GetPointInfoAsXml(strTag, pvInfoXml) MsgBox pvInfoXml
pvInfoXml = "" bRetrieved = PointFacQuery.GetPointCommentAsXml(strTag, pvInfoXml) MsgBox pvInfoXml
Next
'clear the query and the cache PointFacQuery.ClearQueryResults
End If
PointFacQuery.CancelPointFacFiltering() PointFacQuery.DestroyPointFacFilter(100)
End Sub |
The SetPointFilter method sets the point filter from an XML string.
SetPointFilter(XmlFilter As String) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
XmlFilter |
Yes |
The XML string representing the point filter to be set. |
This method returns false if the XML filter is invalid.
The following is an example of an XML point filter.
|
<ExportedRules exportTime='8/17/2019 11:05:13.230' ruleDataIdentifier='PNT Rules'> <Rules enabled='true' inverted='false' op='1' name=''> <Rule enabled='true' name='' referenceAttr='0' compareToType='0' value='CYGDEMO.UIS' operator='=' qualifier='Case Insensitive'> <compareItem attr='siteservice'/> </Rule> <Rule enabled='true' name='' referenceAttr='0' compareToType='0' value='true' operator='=' qualifier='Case Insensitive'> <compareItem attr='hascomment'/> </Rule> </Rules> </ExportedRules> |
This filter will select all points for which (siteservice = "CYGDEMO.UIS" AND hascomment = "true"). Note that the "op='1'" attribute specifies that the rules are ANDed. To OR a set of rules, use "op='0'". For a complete list of PNT XML property names, see PNT XML Attributes.
Example
The following example goes through the entire process of creating a filter, setting the CVS site services, setting facility and point filters, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
|
Sub
'-----------------SETUP------------------
Dim bCreatedOk bCreatedOk = PointFacQuery.CreatePointFacFilter(5)
Dim bIsRunning bIsRunning = PointFacQuery.IsPointFacFilterRunning()
PointFacQuery.ClearQueryResults
Dim bSetServices bSetServices = PointFacQuery.SetCvsSiteServices("CYGDEMO.UIS")
'set the FAC filter from an existing XML (see the documentation for 'SetFacilityFilter for an example of an XML filter) Dim bSetFilter bSetFilter = PointFacQuery.SetFacilityFilter(g_xmlFacFilter)
'set the PNT filter from an existing XML (see the documentation for 'SetPointFilter for an example of an XML filter) bSetFilter = PointFacQuery.SetPointFilter(g_xmlPntFilter)
Dim bNotificationSet bNotificationSet = PointFacQuery.SetNotificationPoint("CYGDEMO.UIS:EVENTIF_NOTIFICATION_PT")
'-----------------EXECUTION------------------
Dim bFilteringStarted bFilteringStarted = PointFacQuery.StartPointFacFiltering
WScript.Sleep(5000) 'simulating polling the notification point
'-----------------RESULTS------------------
Dim pvTagList, bGotList pvTagList = "" bGotList = PointFacQuery.GetFilteredPointList(pvTagList)
Dim nSize, bGotSize nSize = 0 bGotSize = PointFacQuery.GetFilteredPointListSize(nSize)
If nSize > 0 Then
Dim strTag, pvInfoXml, bRetrieved, iRec For iRec = 0 To UBound(pvTagList)
strTag = pvTagList(iRec)
pvInfoXml = "" bRetrieved = PointFacQuery.GetPointInfoAsXml(strTag, pvInfoXml) MsgBox pvInfoXml
pvInfoXml = "" bRetrieved = PointFacQuery.GetPointCommentAsXml(strTag, pvInfoXml) MsgBox pvInfoXml
Next
'clear the query and the cache PointFacQuery.ClearQueryResults
End If
PointFacQuery.CancelPointFacFiltering() PointFacQuery.DestroyPointFacFilter(100)
End Sub |
The StartPointFacFiltering method initiates point fac filtering on the background thread.
StartPointFacFiltering() As Boolean
This method returns false if no point fac filter has been created.
It is good practice to clear any previous query results with ClearQueryResults before calling this method.
Example
The following example goes through the entire process of creating a filter, setting the CVS site services, setting facility and point filters, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
|
Sub
'-----------------SETUP------------------
Dim bCreatedOk bCreatedOk = PointFacQuery.CreatePointFacFilter(5)
Dim bIsRunning bIsRunning = PointFacQuery.IsPointFacFilterRunning()
PointFacQuery.ClearQueryResults
Dim bSetServices bSetServices = PointFacQuery.SetCvsSiteServices("CYGDEMO.UIS")
'set the FAC filter from an existing XML (see the documentation for 'SetFacilityFilter for an example of an XML filter) Dim bSetFilter bSetFilter = PointFacQuery.SetFacilityFilter(g_xmlFacFilter)
'set the PNT filter from an existing XML (see the documentation for 'SetPointFilter for an example of an XML filter) bSetFilter = PointFacQuery.SetPointFilter(g_xmlPntFilter)
Dim bNotificationSet bNotificationSet = PointFacQuery.SetNotificationPoint("CYGDEMO.UIS:EVENTIF_NOTIFICATION_PT")
'-----------------EXECUTION------------------
Dim bFilteringStarted bFilteringStarted = PointFacQuery.StartPointFacFiltering
WScript.Sleep(5000) 'simulating polling the notification point
'-----------------RESULTS------------------
Dim pvTagList, bGotList pvTagList = "" bGotList = PointFacQuery.GetFilteredPointList(pvTagList)
Dim nSize, bGotSize nSize = 0 bGotSize = PointFacQuery.GetFilteredPointListSize(nSize)
If nSize > 0 Then
Dim strTag, pvInfoXml, bRetrieved, iRec For iRec = 0 To UBound(pvTagList)
strTag = pvTagList(iRec)
pvInfoXml = "" bRetrieved = PointFacQuery.GetPointInfoAsXml(strTag, pvInfoXml) MsgBox pvInfoXml
pvInfoXml = "" bRetrieved = PointFacQuery.GetPointCommentAsXml(strTag, pvInfoXml) MsgBox pvInfoXml
Next
'clear the query and the cache PointFacQuery.ClearQueryResults
End If
PointFacQuery.CancelPointFacFiltering() PointFacQuery.DestroyPointFacFilter(100)
End Sub |